import React, { Component } from 'react'
import { NavBar,InputItem,WhiteSpace,List,Button } from 'antd-mobile';

import './login.css'

class Login extends Component {

    state={
        username:'',
        password:''
    }

    handleChange=(key, val)=>{
        this.setState({[key]:val});
    }

    loginSubmit=()=>{
        console.log(this.state)
        console.log(this.props)
        this.props.history.push('/')
    }

    render() {
        return (
            <div>
                <NavBar>门店登录</NavBar>

                <WhiteSpace />
                <List className="loginBox">
                    <InputItem value={this.state.username} onChange={(e)=>{this.handleChange('username', e)}}>用户名</InputItem>
                    <InputItem type="password" value={this.state.password} onChange={(e)=>{this.handleChange('password', e)}}>密码</InputItem>
                    <WhiteSpace />
                    <List.Item>
                        <Button type="primary" onClick={this.loginSubmit}>登录</Button>
                    </List.Item>
                </List>
            </div>
        )
    }
}

export default Login